package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.Installment;
import org.iabako.shared.entity.business.Payment;
import org.iabako.shared.entity.business.Sale;
import org.iabako.shared.entity.business.SaleProductService;
import org.iabako.shared.exception.IabakoActionForbiddenException;
import org.iabako.shared.exception.IabakoPackageForbiddenException;
import org.iabako.shared.exception.IabakoStockException;
import org.iabako.shared.exception.IabakoUniqueConstraintException;
import org.iabako.shared.iservice.generic.EnMasseServiceAsync;
import org.iabako.shared.querydefinition.dto.QueryResultDTO;

import java.util.List;
import java.util.Map;

/**
 * Created by jose on 07/03/15.
 */
public interface SaleEnMasseServiceAsync extends EnMasseServiceAsync {

    void save(Map<Long, QueryResultDTO> clientList, Sale sale, List<SaleProductService> productsServices, List<Payment> payments,
              List<Installment> installments, AsyncCallback<Void> iabakoAsyncCallback);

    public static final class Util {
        private static SaleEnMasseServiceAsync instance;

        public static final SaleEnMasseServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(SaleEnMasseService.class);
            }
            return instance;
        }
    }
}
